perm filename ITSV.MID[1,MRC] blob
sn#289069 filedate 1977-06-17 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 title ITSV
C00007 ENDMK
C⊗;
title ITSV
subttl Mark Crispin
; Converts a file with the ITS extended ASCII set into the SAIL
; extended ASCII set. The purpose of mapping is so that a file
; with the ITS character set can be listed with @ at SAIL then
; converted and output to the XGP, leaving the original file in
; its canonical form.
file: block 4 ; file LOOKUP/ENTER block
ibufh: block 3 ; file input buffer header
obufh: block 3 ; file output buffer header
itsv: jfcl ; no CCL entry
reset ; reset all I/O
open [0 ? 'DSK,, ? ibufh] ; open input side
jrst 4,.-1
open 1,[0 ? 'DSK,, ? obufh,,] ; open output side
jrst 4,.-1
; Super simple filename reader
outstr [asciz/File: /]
move 1,[440600,,file] ; load filename pointer
getfsp: inchwl ; get a file character
cain ". ; ready for extension?
jrst [ move 1,[440600,,file+1] ; yup, point there then
jrst getfsp] ; and continue
cain ↑M ; got a CR?
jrst gotfsp ; yup, all done
idpb 1 ; no, save character
jrst getfsp ; get another one
gotfsp: inchrs ; gobble down line feedd
jfcl ; ignore skip return
lookup file ; try to find file
jrst [ outstr [asciz/File not found?/]
exit]
setzm file+2 ? setzm file+3 ; flush cruft
enter 1,file ; try to make file
jrst [ outstr [asciz/Can't overwrite file?/]
exit]
filhak: sosg ibufh+2 ; buffer ready?
in ; no, get another buffer
caia ; won
exit ; all done
ildb ibufh+1 ; get a character
cain 013 ; map integral sign into ↑
jrst [ movei "↑ ? jrst filout]
cain 030 ; map _ into ←
jrst [ movei "← ? jrst filout]
cain 032 ; map ~ into ≠
jrst [ movei "≠ ? jrst filout]
; There is no way these instructions can win, since losey SAIL fonts
; do not have integral sign and diamond on them. Also, there is no
; no code in the SAIL character set for caret anyway, and ITS hackers
; always use caret as an ugly uparrow, so... Integral sign is
; implemented in ITS in a crockish way; on TV's it is hidden as image
; tab, and on XGP fonts it is character 177. TV character 177 is blob
; which is unavailable anyway since random things used to blob all
; over the place...(can't ANYBODY win ANYWHERE...)
; cain 033 ; map ≠ into diamond
; jrst [ movei 175 ? jrst filout]; cretin ETV eats altmodes
; cain 136 ; map ↑ into integral sign
; jrst [ movei 013 ? jrst filout]
; End of losers
cain 137 ; map ← into _
jrst [ movei "_ ? jrst filout]
cain 175 ; map diamond into }
jrst [ movei "} ? jrst filout]
cain 176 ; map } into ~
movei "~
filout: sosg obufh+2 ; is this buffer ready?
out 1, ; no, empty it
caia ; winnitude
jrst 4,.-2 ; lossage
idpb obufh+1 ; output character
jrst filhak ; and charge on
end ITSV